﻿#ifndef GAMEAREA_H
#define GAMEAREA_H

#include <QWidget>
#include <QPaintEvent>
#include <QPainter>
#include <QMap>
#include <QVector>
#include <QRandomGenerator>
#include <QDebug>
#include <QMouseEvent>
#include <QMessageBox>
#include <QtAlgorithms>
const int ROW_COUNT=10;
const int COLUMN_COUNT=10;
const int IMAGE_WIDHT=32;
const int IMAGE_HEIGHT=32;


class GameArea : public QWidget
{
    Q_OBJECT
public:
  explicit GameArea(QWidget *parent = nullptr);
    void paintEvent(QPaintEvent *e);
    void newGame();
    bool canBeLinked(int row1,int col1,int row2,int col2);
    bool inOneLine(int row1,int col1,int row2,int col2);
    bool inTwoLine(int row1,int col1,int row2,int col2);
    int getProgress();
    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *e);
private:
    bool showGameArea;
    int PixmapData[ROW_COUNT][COLUMN_COUNT];
    QVector<QVector<bool>>* isEmpty;
    int clickCount;
    int firstClickX;
    int firstClickY;
signals:
    void restart();
            void hasWin();
            void updateProgress();
            void winCancel();
public slots:
};

#endif // GAMEAREA_H
